<?php
/**
 * @Author: Marte
 * @Date:   2017-08-16 13:10:38
 * @Last Modified by:   Marte
 * @Last Modified time: 2017-08-23 17:36:37
 */
session_start();
if(isset($_GET['change']))
{
    $change=$_GET['change'];
}
else{
    $change=2;
}

require 'data/config_connect.php';//链接数据库
header("Content-Type: text/html; charset=utf-8");   //设置网页编码

if(!isset($_GET['bookid']))
{
     exit('非法访问!');
}
$bookid=$_GET['bookid'];
$sql='select * from books where bookid="'.$bookid.'"';
$_result=$_mysql->query($sql);
$_assoc=$_result->fetch_assoc();
//得到的是书的信息




//如果收到了章节号码，就设置secnum为其值
if(isset($_GET['secnum']))
{
    $secnum=$_GET['secnum'];

}else{
    // 否则默认显示第一章
    $secnum=1;
}
$_bookid=$_assoc['bookid'];
$sql1="select * from book_section where bookid='$_bookid' and secnum='$secnum' ";
//查找到对应bookid和章节的记录
$_result1=$_mysql->query($sql1);
$sec_total=mysqli_affected_rows($_mysql);
$_assoc1=$_result1->fetch_assoc();

require 'common/change_num.func.php';
//得到章节信息


//目录下

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title><?php echo $_assoc['bookname']?></title>
     <link rel="shortcut icon" href="title.ico" />
    <link rel="stylesheet" type="text/css" href="css/read_page.css">
    <link rel="stylesheet" type="text/css" href="plug_ins/totop/totop.css">
    <script src="js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="plug_ins/totop/totop.js" type="text/javascript" charset="utf-8" async defer></script>
    <script src="plug_ins/picborder/jquery.insetborder.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<div class="header">
<div class="header_main">
    <div class="header_left">
        <img src="images/readlogo.png" alt="">
    </div>
    <div class="header_center">
        <ul>
            <li><a href="index.php" title="">首页</a></li>
            <li><a href="allbooks.php" title="">墨轩书城</a></li>
            <li><a href="" title="">快速导航</a></li>
        </ul>
    </div>
    <div class="header_right">
    <?php

        if(isset($_SESSION['username']))
        {
            $username=$_SESSION['username'];
            echo '<ul>
                <li><a href="person.php" title="">'.$username.'<em>|</em></a></li>
                <li><a href="data/user/logout.php?exit=1" title="">退出<em>|</em></a></li>
                <li><a href="person.php?change=2" title="">充值</a></li>
            </ul>';

        }else
        {
            echo '<ul>
                <li><a href="dl.php" title="">登录<em>|</em></a></li>
                <li><a href="zc.php" title="">注册<em>|</em></a></li>
                <li><a href="person.php?change=3" title="">充值</a></li>
            </ul> ';
        }

    ?>

    </div>
</div>

</div>
<div class="clear">

</div>


<p class="sort"><a href="bookinfo.php?id=<?php echo $_assoc['bookid']?>" title="">首页</a><em>></em><a href="" title="">
    <?php
                                  switch($_assoc['typeid'])
                                  {
                                    case 1:echo "玄幻" ;break;
                                    case 2:echo "奇幻";break;
                                    case 3:echo "武侠";break;
                                    case 4:echo "仙侠";break;
                                    case 5:echo "都市";break;
                                    case 6:echo "现实";break;
                                    case 7:echo "历史";break;
                                    case 8:echo "军事";break;
                                    case 9:echo "校园";break;
                                    case 10:echo "游戏";break;
                                    case 11:echo "言情";break;
                                    case 12:echo "灵异";break;
                                    case 13:echo "N次元";break;

                              }
                             ?>
</a><em>></em><a href="" title=""><?php echo $_assoc['lable']?></a></p>

        <div class="content">
            <div class="ml">
                <ul>
                    <li class="l"><a href="read_page.php?change=1&bookid=<?php echo $_assoc1['bookid']?>" title=""><img src="images/read_bg/ml.png" alt="">目录</a></li>
                    <li class="shujia"><a href="mybookrack.php" title=""><img src="images/read_bg/shujia.png" alt="">书架</a></li>
                    <li class="shezhi"><a href="" title=""><img src="images/read_bg/shezhi.png" alt="">设置</a></li>
                    <li class="last"><a href="read_page.php?change=2&bookid=<?php echo $_assoc1['bookid']?>" title=""><img src="images/read_bg/sou.png" alt="">正文</a></li>
                </ul>
            </div>


           <?php
            switch($change)
            {
                case 2:include 'include/read_page_content.inc.php';break;
                case 1:include 'include/read_page_ml.inc.php';break;
            }
           ?>

        </div>

<a href="#0" class="cd-top">Top</a>
<script type="text/javascript">

    $(document).ready(function(){

        $('.bottom').find('a').borderEffect({borderColor : '#ffffff'});

    });

</script>
</body>
</html>
